import pandas as pd

from stressPrinter.Model.Globalvariables import *

columns = ['sta', 'length', 'wallThick', 'holeDepth', 'initialPress']


def labelsInit(sIDs):
    vs = ['CD', 'BH', 'KS', 'CSY']
    labels = []
    data_list = []
    for index, sta in enumerate(STATION_dict):
        data = {}
        data['sta'] = sta
        data['length'] = STATION_CD[index]
        data['wallThick'] = STATION_BH[index]
        data['holeDepth'] = STATION_KS[index]
        data['initialPress'] = STATION_CSY[index]
        data_list.append(data)

    df = pd.DataFrame(data=data_list, columns=columns)
    for sID in sIDs:
        if sID in df['sta'].to_list():
            iLabelStrList = [sID]
            if 'CD' in vs:
                length = df[(df['sta'] == sID)]['length'].values[0]
                iLabelStrList.append(length)
            if 'BH' in vs:
                wallThick = df[(df['sta'] == sID)]['wallThick'].values[0]
                iLabelStrList.append(wallThick)
            if 'KS' in vs:
                holeDepth = df[(df['sta'] == sID)]['holeDepth'].values[0]
                iLabelStrList.append(holeDepth)
            if 'CSY' in vs:
                initialPress = df[(df['sta'] == sID)]['initialPress'].values[0]
                iLabelStrList.append(initialPress)
            labels.append(','.join(iLabelStrList))
        else:
            labels.append(sID)
    # print(labels)
    return labels


if __name__ == '__main__':
    labelsInit(['G12-1', '51-2'])
